package end.handler.comet;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.comet4j.core.CometContext;

import end.constant.Const;

/**
 * 
 * CometMsg 上午10:55:32 Copyright zhaocj Inc. All rights reserved. Love Me Like
 * Love Justin Bieber
 * 
 */
public class CometMsg implements ServletContextListener {
	@Override
	public void contextDestroyed(ServletContextEvent sce) {
	}

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		sce.getServletContext().log("　+　启动公告长连接");
		CometContext cc = CometContext.getInstance();
		// 注册应用
		cc.registChannel(Const.COMET_CHANNEL_ANNOUNCES_STATUS);
		cc.registChannel(Const.COMET_CHANNEL_SERVER_FLAG);
		/*Thread clientNormal = new Thread(new ClientNormal(),
				"Sender App Module");
		// 是否启动
		clientNormal.setDaemon(true);
		clientNormal.start();*/
	}
}
